package indi.zhifa.study2024.nbr.util.billNo;

import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class BillNoUtil {

    Map<String,BillNoGenObject> mBillNoGenObjectMemo = new HashMap<String,BillNoGenObject>();

    public String getBillNo(String pPrefix) {
        BillNoGenObject billNoGenObject = mBillNoGenObjectMemo.get(pPrefix);
        if(null == billNoGenObject) {
            billNoGenObject = new BillNoGenObject(pPrefix);
            mBillNoGenObjectMemo.put(pPrefix, billNoGenObject);
        }
        return billNoGenObject.next();
    }
}
